	<template>

		<web-view :src="webPageUrl" bindmessage="handleWebViewMessage"></web-view>

	</template>
	<script>
		import {
			getmpurl
		} from '@/api/index'
		import {
			onLoad,
			onShow,
			onPageScroll,
			onHide
		} from '@dcloudio/uni-app'
		export default {
			data() {
				return {
					webPageUrl: '',
					//webPageUrl: 'https://t3128307-1-43.qingguo959.com',
				}
			},
			onLoad(options) {
				console.log(options)
				if (options.mpurlid) {
					//获取跳转配置
					let obj = {
						app_id: uni.getAccountInfoSync().miniProgram.appId,
						id: options.mpurlid,
					}
					getmpurl(obj).then((res) => {
						console.log(res)
						this.webPageUrl = res.url
					}).catch(err => {
						uni.switchTab({
							url: '/pages/index/index'
						})
					})

				} else {
					uni.switchTab({
						url: '/pages/index/index'
					})
				}


			},
			async onShow() {

			},

			methods: {
				handleWebViewMessage: function(e) {
					const data = e.detail.data; // 网页发送的数据  
					// 根据数据执行相应的操作  
				},

			}
		}
	</script>
	<style scoped lang="scss"></style>